<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Amaze UI Admin index Examples</title>
    <meta name="description" content="商家后台">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="apple-mobile-web-app-title" content="商家后台" />
    <link rel="stylesheet" href="assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="assets/css/amazeui.datatables.min.css" />
    <link rel="stylesheet" href="assets/css/app.css">
    <script src="assets/js/jquery.min.js"></script>

</head>

<body data-type="login">
    <script src="assets/js/theme.js"></script>
    <div class="am-g tpl-g">
        <!-- 风格切换 -->
        <div class="tpl-skiner">
            <div class="tpl-skiner-toggle am-icon-cog">
            </div>
            <div class="tpl-skiner-content">
                <div class="tpl-skiner-content-title">
                    选择主题
                </div>
                <div class="tpl-skiner-content-bar">
                    <span class="skiner-color skiner-white" data-color="theme-white"></span>
                    <span class="skiner-color skiner-black" data-color="theme-black"></span>
                </div>
            </div>
        </div>
        <div class="tpl-login">
            <div class="tpl-login-content">
                <div class="tpl-login-logo">

                </div>


				<!--js表单验证-->
                <form class="am-form tpl-form-line-form" id="doc-vld-ajax"  >
                	 <fieldset>
                	
                    <div class="am-form-group">
                        <input type="text" class="tpl-form-input" id="seller_name" placeholder="请输入公司账号" autocomplete="off";   >
                    </div>
                    
                    <div class="am-form-group">
                        <input type="text" class="tpl-form-input" id="seller_account" placeholder="请输入个人账号" autocomplete="off";  >
                        <input type="hidden"  id="j_username" name="j_username" />
                    </div>

                    <div class="am-form-group">
                        <input type="password" class="tpl-form-input"  id="password" placeholder="请输入密码" autocomplete="off";  >
                    </div>
                    <div class="am-form-group tpl-login-remember-me">
                        <input id="remember-me" type="checkbox">
                        <label for="remember-me">
       
                        记住密码
                         </label>

                    </div>

                    <div class="am-form-group">

                        <button type="submit" class="am-btn am-btn-primary  am-btn-block tpl-btn-bg-color-success  tpl-login-btn">提交</button>

                    </div>
                    </fieldset>
                </form>
            </div>
        </div>
    </div>
    <script src="assets/js/amazeui.min.js"></script>

    <script>
$(function() {
	
  var $form = $('#doc-vld-ajax');

  $form.validator({
    submit: function() {
    	
      var sellerName = $('#seller_name').val();
	  var sellerAccount = $('#seller_account').val();
	  var passwords = $('#password').val();
	  alert(sellerName);
	  
        
        $.ajax({
		  type: 'POST',
		  url: 'http://localhost:8080/passport/checkIn.do',
		  data: {'username':sellerName},
		  success: function(data){
		  	alert(data);
		  	return data;
		  },
		  dataType: dataType
		});
			  
       return false;
    }
  });


//$('#doc-vld-ajax').validator({
  	
  	
//submit: function() {
//  var formValidity = this.isFormValid();
//
//
//
//
//
//  $.when(formValidity).then(function() {
//    // 验证成功的逻辑
//    alert(1);
//  }, function() {
//    // 验证失败的逻辑
//    alert(2);
//  });
//}
//,
//

//  validate: function(validity)  //验证操作
//  {
//   //	$(validity.field) 表单字段
//  validity.valid=false;
//  console.log(1);
//  return validity;
//  	
//    var v = $(validity.field).val();
//	  var username=$('#seller_name').val();
//
//    // Ajax 验证
//    //if ($(validity.field).is('.js-ajax-validate')) {
//      // 异步操作必须返回 Deferred 对象
//      $.ajax({
//        url: 'http://localhost:8080/passport/checkIn.htm',
//        data:{'username':username},
//        dataType: 'json'
//      }).then(function(data) {          
//        validity.valid=true;
//      }, function() {
//        validity.valid=false;
//      });
//      return validity;
//      }

      // 本地验证，同步操作，无需返回值
//    if ($(validity.field).is('.js-sync-validate')) {
//      comparer(10, v);
//      // return validity;
//    }
//  }
//});
});
    </script>

</body>

</html>